package com.alks.function.controller.finance.costcheck;

import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.WebLogger;
import com.alks.entity.data.entity.PcLotMtlPrice;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.data.request.mtl.GenericMaterialDocReq;
import com.alks.function.service.impl.PcLotMtlPriceServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;


@ApiRestController("/mtl")
@Api(tags = "通用材料单价建档")
public class GenericMaterialController {
    @Autowired
    PcLotMtlPriceServiceImpl priceService;

    @PostMapping("/getGenericMaterialDetail")
    @WebLogger
    @ApiOperation(value = "通用材料建档明细")
    public ResponseInfo getGenericMaterialDetail(@RequestBody GenericMaterialDocReq req) {
        return priceService.getGenericMaterialDetail(req);
    }

    @PostMapping("/optionGenericMtl")
    @WebLogger
    @ApiOperation(value = "打勾记录复制、删除")
    public ResponseInfo optionGenericMtl(@RequestBody List<PcLotMtlPrice> list, @RequestParam @ApiParam(value = "1：打勾记录添加 2：打勾记录删除") String choose) {
        return priceService.optionGenericMtl(list, choose);
    }

    @PostMapping("/updateGenericMtl")
    @WebLogger
    @ApiOperation(value = "更新材料档")
    public ResponseInfo updateGenericMtl(@RequestBody List<PcLotMtlPrice> list) {
        return priceService.updateGenericMtl(list);
    }

    //填充单间作业
    @PostMapping("/updateGenericMtlWP")
    @WebLogger
    @ApiOperation(value = "填充厂商单价")
    public ResponseInfo updateGenericMtlWP(@RequestBody List<PcLotMtlPrice> list, @RequestParam @ApiParam String vendorName, @RequestParam @ApiParam String vendorNo, @RequestParam @ApiParam BigDecimal price) {
        return priceService.updateGenericMtlWP(list,vendorName,vendorNo,price);
    }


}
